LIBNAME=logger
#定义一个变量指定文件和安装路径

INSTPATH=`pwd`/../include/ 
LIBPATH=`pwd`/../lib/ 
CFLAGS+=-I ${INSTPATH}
CFLAGS+=-I `pwd`/../sqlite/include/

CC=gcc
AR=ar 

all: dynamic_lib
	make clear
	make install

dynamic_lib:
	${CC} -shared -fPIC ${LIBNAME}.c -o lib${LIBNAME}.so ${CFLAGS}

static_lib:
	${CC} -c *.c   ${CFLAGS} 
	${AR} -rcs lib${LIBNAME}.a *.o ${LDFLAGS}



#install是一个单独的目标，它用来将编译生成的库文件和头文件拷贝到相应的安装路径下

install:
	cp -rf lib${LIBNAME}.* ${LIBPATH}


#clear将编译生成的object临时文件删除
clear:
	rm -f *.o



#clean先clear临时文件，之后再删除编译产生的库文件 默认不执行
clean:clear
	rm -f lib${LIBNAME}.*


